package com.nan.translation;

import com.nan.translation.model.User;
import com.nan.translation.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider;

@SpringBootApplication
public class TranslationBackendApplication  implements ApplicationRunner {

    private final UserService userService;

    public static void main(String[] args) {
        SpringApplication.run(TranslationBackendApplication.class, args);
    }

    @Bean
    EvoInflectorLinkRelationProvider relProvider() {
        return new EvoInflectorLinkRelationProvider();
    }

    @Autowired
    public TranslationBackendApplication(UserService login) {
        this.userService = login;
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        userService.addUser(new User("test", "111111"));
        userService.addUser(new User("mr.nan0505", "19990505"));
    }
}
